export default function TimeFormat(newTime,oldTime){
  const minute=1000*60;      //把分，时，天，周，半个月，一个月用毫秒表示
  const  hour=minute*60;
  const day=hour*24;
  const week=day*7;
  const month=day*30;
  const diffValue=Date.parse(newTime)-Date.parse(oldTime);//时间差
  if(diffValue<0){return;}
  const  minC=diffValue/minute;  //计算时间差的分，时，天，周，月
  const  hourC=diffValue/hour;
  const  dayC=diffValue/day;
  const  weekC=diffValue/week;
  const  monthC=diffValue/month;
  let result ='';
  if(monthC>=1){
    result=" "+parseInt(monthC)+"月前"
  }
  else if(weekC>=1){
    result=" "+parseInt(weekC)+"周前"
  }
  else if(dayC>=1){
    result=" "+parseInt(dayC)+"天前"
  }
  else if(hourC>=1){
    result=" "+parseInt(hourC)+"小时前"
  }
  else if(minC>=1){
    result=" "+parseInt(minC)+"分钟前"
  }
  else{
    result="刚刚";
  }
  return result
}
